<template>
	<view class="beijing1" style="position: relative">
		<u-navbar :placeholder="true" title="妆造预定" @rightClick="rightClick" :autoBack="true" bg-color="transparent"></u-navbar>
		<image src="/static/beitu.png" mode="" style="position: absolute; z-index: 0; top: 0; width: 100vw; height: 100vh"></image>
		<view class="" style="margin-top: 20rpx">
			<u-swiper radius="0rpx" keyName="image" :list="list1" height="450rpx" indicator indicatorMode="dot"></u-swiper>
		</view>
		<view class="" style="padding: 0 25rpx; position: relative; z-index: 1; margin-top: -60rpx">
			<view class="" style="background: #ffffff; border-radius: 10rpx; padding: 30rpx">
				<view class="flex">
					<view class="" style="width: 6rpx; height: 30rpx; background: #8c1608; border-radius: 3rpx; margin-left: -30rpx"></view>
					<text style="font-weight: 400; font-size: 30rpx; color: #11130b; margin-left: 30rpx">性别</text>
				</view>
				<view class="flex1" style="flex-wrap: wrap; margin-top: 20rpx">
					<view class="" v-for="(item, index) in sexList" :key="index" @click="sexClick(item.id)">
						<view class="center wei1" style="" :class="{ xvan1: sexId == item.id }">
							<view class="" style="padding: 7rpx">{{ item.title }}</view>
						</view>
					</view>
				</view>
			</view>
			<view class="" style="background: #ffffff; border-radius: 10rpx; padding: 30rpx">
				<view class="flex">
					<view class="" style="width: 6rpx; height: 30rpx; background: #8c1608; border-radius: 3rpx; margin-left: -30rpx"></view>
					<text style="font-weight: 400; font-size: 30rpx; color: #11130b; margin-left: 30rpx">选择朝代</text>
				</view>
				<view class="flex1" style="flex-wrap: wrap; margin-top: 20rpx">
					<view class="" v-for="(item, index) in chaodailist" :key="index" @click="qiec(item.id)">
						<view class="center wei1" style="" :class="{ xvan1: dynasty_id == item.id }">
							<view class="" style="padding: 7rpx">{{ item.title }}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="" style="padding: 0 25rpx; position: relative; z-index: 1; margin-top: 20rpx">
			<view class="" style="background: #ffffff; border-radius: 10rpx; padding: 30rpx">
				<view class="flex">
					<view class="" style="width: 6rpx; height: 30rpx; background: #8c1608; border-radius: 3rpx; margin-left: -30rpx"></view>
					<text style="font-weight: 400; font-size: 30rpx; color: #11130b; margin-left: 30rpx">服装预定</text>
				</view>
				<view class="" style="height: 40rpx"></view>
				<view class="xun" style="" v-for="(item, index) in yifulist" :key="index" @click="xqa(item.id)">
					<view class="flex1">
						<image :src="img + item.image" mode="" style="width: 130rpx; height: 130rpx; border-radius: 10rpx"></image>
						<view class="column between1" style="margin-left: 25rpx; width: 100%">
							<view class="between">
								<text style="font-weight: 400; font-size: 28rpx; color: #11130b">{{ item.title }}</text>
								<view class="">
									<text style="font-weight: 400; font-size: 24rpx; color: #8c1608">¥</text>
									<text style="font-weight: 400; font-size: 30rpx; color: #8c1608">{{ item.price }}</text>
								</view>
							</view>
							<view class="sl2" style="font-weight: 400; font-size: 24rpx; color: #888888; line-height: 42rpx">
								{{ item.des }}
							</view>
						</view>
					</view>
					<view class="flex1" style="margin-top: 30rpx; justify-content: flex-end">
						<view class="flex1" style="justify-content: flex-end" @click.stop="yv(item.id)">
							<view class="center" style="width: 140rpx; height: 50rpx; background: #8c1608; border-radius: 25rpx">
								<text style="font-weight: 400; font-size: 24rpx; color: #ffffff; line-height: 0">预约时间</text>
							</view>
						</view>
					</view>
					<view class="" style="padding: 40rpx 0">
						<u-line></u-line>
					</view>
				</view>
			</view>
		</view>
		<view class="" style="height: 200rpx"></view>
		<view class="" style="position: fixed; bottom: 0; width: 100%; z-index: 1; background: white">
			<view class="" style="padding: 20rpx 25rpx 0">
				<view class="" style="height: 160rpx; background: #ffffff">
					<view class="between" style="">
						<view class="flex">
							<image src="/pagesA/static/shizh.png" mode="" style="width: 25rpx; height: 25rpx"></image>
							<text style="margin-left: 15rpx; font-weight: 400; font-size: 26rpx; color: #000000">预定时间：{{ time_str }}</text>
						</view>
						<view class="flex" style="" @click="show55 = true">
							<text style="font-weight: 400; font-size: 26rpx; color: #f4a134">切换时间</text>
							<image src="/pagesA/static/qie.png" mode="" style="width: 21rpx; height: 18rpx; padding: 0 20rpx"></image>
						</view>
					</view>
					<view class="" style="padding: 20rpx 0">
						<u-line></u-line>
					</view>
					<view class="between">
						<view class="flex">
							<view class="" style="position: relative">
								<image src="/pagesA/static/gouwu.png" mode="" style="width: 45rpx; height: 44rpx" @click="show1 = true"></image>
								<u-badge shape="circle" max="99" :value="state.goulist.length" absolute :offset="[-8, -10]"></u-badge>
							</view>
							<text style="font-weight: 400; font-size: 30rpx; color: #323232; margin-left: 30rpx">应付金额：¥{{ price }}</text>
						</view>
						<view class="" style="position: relative">
							<view class="" v-if="state.tel == ''">
								<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" style="position: absolute; top: 0; width: 100%; left: 0; opacity: 0">1</button>
							</view>
							<view class="center" style="width: 250rpx; height: 70rpx; background: #8c1608; border-radius: 35rpx" @click="jiesuan">
								<view class="" style="font-weight: 400; font-size: 30rpx; color: #ffffff">去结算</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="" style="height: env(safe-area-inset-bottom)"></view>
		</view>
		<uv-calendars
			:startDate="startDate"
			:endDate="endDate"
			:selected="selected"
			color="#8C1608"
			title="日期选择"
			ref="calendars"
			@confirm="confirm"
			confirmText="12"
			@close="close"
		/>
		<u-popup :show="show" mode="center" round="10rpx" :safeAreaInsetBottom="false">
			<view v-if="Object.keys(chshujv).length > 0" style="background: #f0e9dc; border-radius: 15rpx; width: calc(100vw - 50rpx); height: 1100rpx; position: relative">
				<view class="" style="padding: 50rpx 40rpx; position: relative; z-index: 1">
					<view class="between" style="position: relative">
						<view style="font-weight: 400; font-size: 33rpx; color: #222222">{{ chshujv.clothes.title }}<text style="font-size: 28rpx;margin-left: 15rpx;" v-if="yishiInfo">(库存:{{yishiInfo.left_clothes_stock}})</text></view>
						<view style="font-weight: 400; font-size: 40px; color: #222222; line-height: 0" @click="show = false">×</view>
					</view>
					<view class="" style="font-weight: 400; font-size: 28rpx; color: #010101; margin-top: 40rpx">预约时间</view>
					<view class="between" style="margin-top: 30rpx">
						<u-grid :border="false" col="3">
							<u-grid-item v-for="(item, index) in chshujv.clothes.item" :key="index" :customStyle="{ paddingTop: 20 + 'rpx' }">
								<view
									:class="{ weiy: true, xvany: clothes_item_id == item.id, jiny: item.left_stock <= 0, readonly1: item.left_stock <= 0 }"
									@click="yishi(item)"
								>
									<view class="" style="">
										{{ item.title }}
										<text v-if="item.left_stock <= 0">(已约满)</text>
									</view>
								</view>
							</u-grid-item>
						</u-grid>
					</view>
					<view class="between" style="margin-top: 20rpx">
						<view style="font-weight: 400; font-size: 28rpx; color: #010101">妆造</view>
						<view style="font-weight: 400; font-size: 24rpx; color: #8c1608">
							¥ {{ chshujv.adorn_price.price }}/套
							<text style="color: #888;text-decoration: line-through;margin-left: 15rpx">原价：¥ {{ chshujv.adorn_price.origin_price }}/套</text>
						</view>
					</view>
					<view class="" style="margin-top: 20rpx">
						<uni-data-checkbox :disabled="isDisabled" v-model="has_adorn" :localdata="xvyao" selectedColor="#8C1608"></uni-data-checkbox>
					</view>
					<view class="" style="margin-top: 0rpx">
						<u-grid :border="false" col="4" v-if="has_adorn == 2">
							<u-grid-item v-for="(item, index) in chshujv.adorn_list" :key="index" :customStyle="{ paddingTop: 20 + 'rpx' }">
								<view
									class="center"
									:class="{ weiy: true, xvany: adorn_id == item.id, jiny: item.left_stock <= 0, readonly1: item.left_stock <= 0 }"
									@click="ado(item)"
								>
									<view class="" style="">{{ item.time_str }}</view>
								</view>
							</u-grid-item>
						</u-grid>
					</view>
					<view class="" style="font-weight: 400; font-size: 26rpx; color: #000000; margin-top: 20rpx" v-if="yishiInfo.left_adorn_stock">剩余：{{yishiInfo.left_adorn_stock}}</view>
					<view class="between" style="margin-top: 20rpx">
						<view style="font-weight: 400; font-size: 28rpx; color: #010101">摄影</view>
						<view style="font-weight: 400; font-size: 24rpx; color: #8c1608">
							¥ {{ chshujv.photo_price.price }}/套
							<text style="color: #888;text-decoration: line-through;margin-left: 15rpx">原价：¥ {{ chshujv.photo_price.origin_price }}/套</text>
						</view>
					</view>
					<view class="" style="margin-top: 20rpx">
						<uni-data-checkbox :disabled="isDisabled" v-model="has_photo" :localdata="syao" selectedColor="#8C1608"></uni-data-checkbox>
					</view>
					<view class="" style="margin-top: 0rpx">
						<u-grid :border="false" col="4" v-if="has_photo == 2">
							<u-grid-item v-for="(item, index) in chshujv.photo_list" :key="index" :customStyle="{ paddingTop: 20 + 'rpx' }">
								<view
									class="center"
									:class="{ weiy: true, xvany: photo_id == item.id, jiny: item.left_stock <= 0, readonly1: item.left_stock <= 0 }"
									@click="pho(item)"
								>
									<view class="" style="">{{ item.time_str }}</view>
								</view>
							</u-grid-item>
						</u-grid>
					</view>
					<view class="" style="font-weight: 400; font-size: 26rpx; color: #000000; margin-top: 20rpx" v-if="yishiInfo.left_photo_stock">剩余：{{yishiInfo.left_photo_stock}}</view>



					<view class="between" style="margin-top: 20rpx">
						<view style="font-weight: 400; font-size: 28rpx; color: #010101">套餐组合：妆造、摄影</view>
						<view style="font-weight: 400; font-size: 24rpx; color: #8c1608">
							¥ {{ chshujv.package.price }}/套
							<text style="color: #888;text-decoration: line-through;margin-left: 15rpx">原价：¥ {{ chshujv.package.origin_price }}/套</text>
						</view>
					</view>
					<view class="" style="margin-top: 20rpx">
						<uni-data-checkbox v-model="is_package" :localdata="packageList" selectedColor="#8C1608" @change="packageChange"></uni-data-checkbox>
					</view>
				</view>
				<view class="" style="position: absolute; bottom: 0; right: 0">
					<image src="/static/zhang.png" mode="" style="width: 374rpx; height: 640rpx"></image>
				</view>
				<view class="" style="position: absolute; bottom: 40rpx; width: 100%; z-index: 1">
					<view class="" style="padding: 0 25rpx">
						<view class="center" style="height: 70rpx; background: #8c1608; border-radius: 35rpx" @click="que">
							<view class="" style="font-weight: 400; font-size: 28rpx; color: #ffffff">确定</view>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show1" round="10rpx" bgColor="#f0e9dc" @close="show1 = false">
			<view class="" style="position: relative">
				<view class="" style="position: absolute; bottom: -200rpx; right: 0; z-index: 0">
					<image src="/static/zhang.png" mode="" style="width: 374rpx; height: 640rpx"></image>
				</view>
				<view class="" style="position: relative; z-index: 1">
					<view class="between" style="padding: 50rpx 25rpx">
						<view class="flex">
							<image src="/pagesA/static/shizh.png" mode="" style="width: 25rpx; height: 25rpx"></image>
							<text style="margin-left: 15rpx; font-weight: 400; font-size: 26rpx; color: #000000">预定时间：{{ time_str }}</text>
						</view>
						<!-- <image src="/pagesA/static/qie.png" mode="" style="width: 21rpx; height: 18rpx"></image> -->
					</view>
					<view class="" style="padding-bottom: 40rpx">
						<u-line></u-line>
					</view>
					<view class="" style="padding: 0 25rpx">
						<view class="between">
							<u-checkbox-group v-model="chqvan" placement="column" @change="chqvanc" shape="circle" activeColor="#F30B03">
								<u-checkbox label="全选" name="1"></u-checkbox>
							</u-checkbox-group>
							<text style="font-weight: 400; font-size: 28rpx; color: #888888" @click="shani">一键清除</text>
						</view>
						<scroll-view style="height: 60vh" scroll-y>
							<u-checkbox-group v-model="checkboxValue1" placement="column" shape="circle" @change="zixvan" activeColor="#F30B03">
								<view class="xun" v-for="(item, index) in state.goulist" :key="index">
									<view class="flex1" style="margin-top: 50rpx">
										<view class="flex">
											<u-checkbox :name="item.id"></u-checkbox>
											<image :src="img + item.image" mode="" style="width: 120rpx; height: 120rpx; border-radius: 10rpx"></image>
										</view>
										<view class="column between1" style="width: 100%; margin-left: 30rpx">
											<view class="between">
												<view class="" style="font-weight: 400; font-size: 30rpx; color: #222222">{{ item.title }}</view>
												<view class="" style="font-weight: 400; font-size: 30rpx; color: #000000">×1</view>
											</view>
											<view class="between">
												<view class="" style="font-weight: 400; font-size: 24rpx; color: #8c1608">
													<text v-if="item.has_adorn == 2" style="margin-left: 10rpx">妆造</text>
													<text v-if="item.has_photo == 2" style="margin-left: 10rpx">摄影</text>
												</view>
												<image src="/pagesA/static/shana.png" mode="" style="width: 30rpx; height: 30rpx" @click="shana(item.id)"></image>
											</view>
										</view>
									</view>
								</view>
							</u-checkbox-group>
							<view class="" style="height: 140rpx"></view>
						</scroll-view>
					</view>
				</view>
				<view class="" style="position: absolute; bottom: 0rpx; width: 100%; z-index: 2; background: #f2f1ef; box-shadow: 0rpx 3rpx 17rpx 1rpx rgba(0, 0, 0, 0.15)">
					<view class="" style="padding: 0 25rpx">
						<view class="between" style="height: 119rpx">
							<view class="">
								<view class="" style="font-weight: 400; font-size: 30rpx; color: #323232">应付金额：¥{{ price }}</view>
								<view class="" style="font-weight: 400; font-size: 24rpx; color: #888888">已选{{ checkboxValue1.length }}件商品</view>
							</view>

							<view class="center" style="width: 250rpx; height: 80rpx; background: #8c1608; border-radius: 40rpx" @click="jiesuan">
								<view class="" style="font-weight: 400; font-size: 30rpx; color: #ffffff">去结算</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<view class="" style="position: fixed; bottom: 0; right: 0">
			<image src="/static/zhang.png" mode="" style="width: 374rpx; height: 640rpx"></image>
		</view>
		<u-modal :show="show55" @cancel="show55 = false" @confirm="confirm55" showCancelButton cancelText="取消" confirmText="确定">
			<view class="" style="width: 100%">
				<view class="center" style="font-weight: bold">提示</view>
				<view class="center" style="margin-top: 50rpx">您确定切换时间吗？确定后将清空购物车</view>
			</view>
		</u-modal>
	</view>
</template>

<script>
import { feastDynastygetList,feastSex,clothesOrderpreOrder,feastClothesgetList, feastClothesapplyDetail, feastclothesapply, commoncommongetMobile, commoncommongetBannerList } from '../../untils/api.js';
export default {
	data() {
		return {
			list1: [],
			dateList: [],
			dateRange: 7,
			a: 0,
			startDate: '',
			endDate: '',
			show: false,
			dis: true,
			dynasty_id: 0,
			c: 0,
			d: 0,
			value: 10,
			has_adorn: 2,
			has_photo: 2,
			is_package:'',
			packageList:[
				{ text: '需要',value: 2},
				{ text: '不需要',value: 1},
			],
			syao: [
				{
					text: '需要',
					value: 2
				},
				{
					text: '不需要',
					value: 1
				}
			],
			xvyao: [
				{
					text: '需要',
					value: 2
				},
				{
					text: '不需要',
					value: 1
				}
			],
			show1: false,
			checkboxValue1: [],
			chqvan: [],
			list: [],
			price: 0,
			yuanprice: 0,
			show2: false,
			biann: true,
			chaodailist: [],
			yifulist: [],
			time_str: '',
			chshujv: {},
			clothes_item_id: '',
			adorn_id: '',
			zshneg: '',
			photo_id: '',
			ssheng: '',
			goulist: [],
			show55: false,
			yishiInfo:'',
			isDisabled:false,
			sexList:'',
			sexId:1
		};
	},
	onLoad(ops) {
		this.init();
		this.qfeastDynastygetList();
		this.time_str = ops.time_str;
		this.qcommoncommongetBannerList();
		this.feastSexFun();
		// this.qgouli();
	},
	onShow() {},
	onReady() {},
	methods: {
		sexClick(id){
			this.sexId = id;
		},
		async feastSexFun(){
			const res = await feastSex();
			this.sexList = res.data;
		},
		packageChange(e){
			console.log(e.detail.value);
			if(e.detail.value == 1){
				this.isDisabled = false;
			} else if(e.detail.value == 2){
				this.isDisabled = true;
			}
		},
		async qcommoncommongetBannerList() {
			const data = await commoncommongetBannerList({
				flag: 'adorn'
			});
			this.list1 = data.data;
			this.list1.forEach((item) => {
				item.image = this.img + item.image;
			});
		},
		confirm55() {
			this.$store.commit('fugai', []);
			this.checkboxValue1 = [];
			if (this.checkboxValue1.length != this.state.goulist.length || this.state.goulist.length == 0) {
				this.chqvan = [];
			}
			uni.navigateBack();
		},
		async getphonenumber(e) {
			console.log(e);
			const data = await commoncommongetMobile({
				code: e.detail.code
			});
			this.$store.commit('ctel', data.data.tel);
		},
		que() {
			if (this.clothes_item_id == '') {
				uni.showToast({
					icon: 'none',
					title: '请选择衣服预约时间',
					duration: 2000
				});
				return;
			}
			/*if (this.has_adorn == 2 && this.adorn_id == '') {
				uni.showToast({
					icon: 'none',
					title: '请选择妆造预约时间',
					duration: 2000
				});
				return;
			}
			if (this.has_photo == 2 && this.photo_id == '') {
				uni.showToast({
					icon: 'none',
					title: '请选择摄影预约时间',
					duration: 2000
				});
				return;
			}*/
			uni.showLoading({
				title: '加载中',
				mask: true
			});
			let yiprice = Number(this.chshujv.clothes.price);
			let zhuangprice = this.has_adorn == 2 ? Number(this.chshujv.adorn_price) : 0;
			let sprice = this.has_photo == 2 ? Number(this.chshujv.photo_price) : 0;
			let price = yiprice + zhuangprice + sprice;
			let item = {
				image: this.chshujv.clothes.image,
				clothes_id: this.chshujv.clothes.id,
				clothes_item_id: this.clothes_item_id,
				time_str: this.time_str,
				has_adorn: this.has_adorn,
				has_photo: this.has_photo,
				adorn_id: this.has_adorn == 2 ? this.adorn_id : '',
				photo_id: this.has_photo == 2 ? this.photo_id : '',
				price: price,
				title: this.chshujv.clothes.title,
				id: uni.$u.guid(3, false, 7),
				sex_id:this.sexId,
				is_package:this.is_package ? this.is_package : 1
			};
			console.log(item);
			this.$store.commit('cun', item);
			this.show = false;
			setTimeout(() => {
				uni.hideLoading();
			}, 500);
			this.chqvan = ['1'];
			this.shouqvx();
		},
		ado(id) {
			this.adorn_id = id.id;
			this.zshneg = id.left_stock;
		},
		pho(id) {
			this.photo_id = id.id;
			this.ssheng = id.left_stock;
		},
		yishi(item) {
			this.yishiInfo = item;
			this.clothes_item_id = item.id;
		},
		async qfeastClothesgetList() {
			const data = await feastClothesgetList({
				dynasty_id: this.dynasty_id,
				time_str: this.time_str
			});
			this.yifulist = data.data;
		},
		qiec(id) {
			this.dynasty_id = id;
			this.yifulist = [];
			this.qfeastClothesgetList();
		},
		async qfeastDynastygetList() {
			const data = await feastDynastygetList();
			this.chaodailist = data.data;
			this.dynasty_id = data.data[0].id;
			this.qfeastClothesgetList();
		},
		xqa(id) {
			uni.navigateTo({
				url: `/pagesA/fuzhuangxq/fuzhuangxq?id=${id}&time_str=${this.time_str}`
			});
		},
		jies() {
			uni.navigateTo({
				url: '/pagesB/zhuangzaozhifumingxi/zhuangzaozhifumingxi'
			});
		},
		biana() {
			this.biann = !this.biann;
		},
		async jiesuan() {
			if (this.checkboxValue1.length == 0) {
				uni.showToast({
					icon: 'none',
					title: '请选择商品',
					duration: 2000
				});
				return;
			}
			let liea = this.state.goulist.filter((item) => this.checkboxValue1.includes(item.id));
			let list1 = {
				liea: liea,
				price: this.price
			};
			// this.state.goulist.filter((item) => !this.checkboxValue1.some((item1) => item1 == item.id))
			this.$store.commit('fugai', []);
			this.checkboxValue1 = [];
			if (this.checkboxValue1.length != this.state.goulist.length || this.state.goulist.length == 0) {
				this.chqvan = [];
			}
			this.jisuanjia();
			uni.showLoading({
				title: '加载中',
				mask: true
			});

			const data = await feastclothesapply({
				item: liea
			});
			if (data.code == 1) {
				uni.showToast({
					icon: 'none',
					title: '操作成功',
					duration: 2000
				});
				uni.navigateTo({
					url: `/pagesB/zhuangzaozhifumingxi/zhuangzaozhifumingxi?id=${data.data.order_id}`
				});
			}
		},
		async shani() {
			if (this.checkboxValue1.length <= 0) {
				uni.showToast({
					icon: 'none',
					title: '请选择',
					duration: 2000
				});
				return;
			}
			uni.showToast({
				icon: 'none',
				title: '已删除',
				duration: 2000
			});
			this.$store.commit(
				'fugai',
				this.state.goulist.filter((item) => !this.checkboxValue1.some((item1) => item1 == item.id))
			);
			// this.state.goulist = this.state.goulist.filter((item) => !this.checkboxValue1.some((item1) => item1 == item.id));
			console.log(this.state.goulist);
			this.checkboxValue1 = [];
			if (this.checkboxValue1.length != this.state.goulist.length || this.state.goulist.length == 0) {
				this.chqvan = [];
			}
			// this.jisuanjia();
			this.price = 0;
		},
		async shana(id) {
			uni.showToast({
				icon: 'none',
				title: '已删除',
				duration: 2000
			});

			let sou = this.checkboxValue1.findIndex((item) => item == id);
			if (sou != -1) {
				this.checkboxValue1.splice(sou, 1);
			}
			this.$store.commit(
				'fugai',
				this.state.goulist.filter((item) => id != item.id)
			);
			// this.state.goulist = this.state.goulist.filter((item) => id != item.id);
			if (this.checkboxValue1.length != this.state.goulist.length || this.state.goulist.length == 0) {
				this.chqvan = [];
			}
			this.jisuanjia();
		},
		async gai(e, id) {
			console.log(e, id);
			const data = await cartmodifyNum({
				id: id,
				num: e.value
			});
			this.jisuanjia();
		},
		shouqvx() {
			if (this.chqvan.length > 0) {
				this.checkboxValue1 = this.state.goulist.map((item) => item.id);
				console.log(this.checkboxValue1);
				this.jisuanjia();
			} else {
				this.checkboxValue1 = [];
				this.jisuanjia();
			}
		},
		chqvanc(e) {
			this.chqvan = e;
			if (this.chqvan.length > 0) {
				this.checkboxValue1 = this.state.goulist.map((item) => item.id);
				console.log(this.checkboxValue1);
				this.jisuanjia();
			} else {
				this.checkboxValue1 = [];
				this.jisuanjia();
			}
		},
		zixvan(e) {
			this.checkboxValue1 = e;
			this.jisuanjia();
			if (this.checkboxValue1.length == this.state.goulist.length) {
				this.chqvan = ['1'];
			} else {
				this.chqvan = [];
			}
		},
		async qgouli() {
			this.price = 0;
			this.yuanprice = 0;
			this.checkboxValue1 = [];
			this.chqvan = [];
			const data = await cartcartList();
			this.state.goulist = data.data.list;
		},
		async jisuanjia() {
			this.price = 0;
			this.yuanprice = 0;
			console.log(this.state.goulist);
			clothesOrderpreOrder({
				item:this.state.goulist
			}).then(res => {
				this.price = res.data.money;
			})
			/*let liea = this.state.goulist.filter((item) => this.checkboxValue1.includes(item.id));
			liea.forEach((item) => {
				this.price += Number(1) * Number(item.price);
				this.yuanprice += Number(1) * Number(item.price);
			});
			this.price = Math.round(this.price * 100) / 100;
			this.yuanprice = Math.round(this.yuanprice * 100) / 100;
			console.log(this.price);*/
		},
		xha() {
			this.dis = true;
			this.show = false;
		},
		finish() {
			this.dis = false;
		},
		tong() {
			uni.navigateTo({
				url: '/pagesA/xvanzuo/xvanzuo'
			});
		},
		async yv(id) {
			const data = await feastClothesapplyDetail({
				clothes_id: id,
				time_str: this.time_str
			});
			this.chshujv = data.data;
			this.show = true;
		},
		close() {
			this.$refs.calendars.close();
		},
		open() {
			this.$refs.calendars.open();
		},
		confirm(e) {
			console.log(e);
		},
		xvan(e) {
			this.a = e;
		},
		rightClick() {
			console.log('rightClick');
		},
		leftClick() {
			console.log('leftClick');
		},
		scrolltolower() {
			console.log('到底了');
		},
		init() {
			const dateInstance = new Date();
			const dateList = [];
			for (var i = 0; i < this.dateRange; i++) {
				dateList.push(this.getDateObjec(this.getNextSomeDay(dateInstance, i)));
			}
			this.dateList = dateList;
			this.startDate = this.dateList[0].year + '-' + this.dateList[0].date_str;
			this.endDate = this.dateList[6].year + '-' + this.dateList[6].date_str;
			console.log(this.dateList);
		},
		getNextSomeDay(date, num) {
			const nextDay = new Date(date);
			nextDay.setDate(nextDay.getDate() + num);
			return nextDay;
		},
		getDateObjec(_date) {
			const dateInstance = _date ? new Date(_date) : new Date();
			const year = dateInstance.getFullYear();
			const month = dateInstance.getMonth() + 1;
			const date = dateInstance.getDate();
			const day = dateInstance.getDay();
			const hour = dateInstance.getHours();
			const dateStr = `${this.fillZero(month)}-${this.fillZero(date)}`;
			const weekStr = this.getWeekStr(day);
			return {
				date_str: dateStr,
				date,
				hour,
				year,
				week_str: '周' + weekStr
			};
		},
		fillZero(num) {
			if (num < 10) {
				return '0' + num;
			}
			return num;
		},
		getWeekStr(week) {
			let week_str = '';
			switch (week) {
				case 0:
					week_str = '日';
					break;
				case 1:
					week_str = '一';
					break;
				case 2:
					week_str = '二';
					break;
				case 3:
					week_str = '三';
					break;
				case 4:
					week_str = '四';
					break;
				case 5:
					week_str = '五';
					break;
				case 6:
					week_str = '六';
					break;
			}
			return week_str;
		}
	}
};
</script>

<style lang="scss" scoped>
.weiy {
	background: #efe7db;
	border-radius: 5rpx;
	border: 1px solid #bfbfbf;
	font-weight: 400;
	font-size: 24rpx;
	color: #222222;
	padding: 14rpx;
}
.xvany {
	background: rgba(140, 22, 8, 0.1);
	border-radius: 5rpx;
	border: 1px solid #8c1608;
	font-weight: 400;
	font-size: 24rpx;
	color: #8c1608;
	padding: 14rpx;
}
.jiny {
	background: #efe7db;
	border-radius: 5rpx;
	border: 1px solid #bfbfbf;
	font-weight: 400;
	font-size: 24rpx;
	color: #888888;
	padding: 14rpx;
}
.wei2 {
	width: 121rpx;
	height: 51rpx;
	background: #efe7db;
	border-radius: 5rpx;
	border: 1px solid #bfbfbf;
	font-weight: 400;
	font-size: 24rpx;
	color: #8c1608;
}
.xvan2 {
	background: rgba(140, 22, 8, 0.1) !important;
	border: 1px solid #8c1608 !important;
	color: #8c1608 !important;
}
.wei1 {
	background: rgba(140, 22, 8, 0);
	border-radius: 3rpx;
	border: 1px solid #bfbfbf;
	margin-top: 20rpx;
	margin-right: 14rpx;
	font-weight: 400;
	font-size: 24rpx;
	color: #11130b;
}
.xvan1 {
	background: rgba(140, 22, 8, 0.1) !important;

	border: 1px solid #8c1608 !important;
	color: #8c1608 !important;
}
::v-deep .u-count-down__text {
	font-weight: 400 !important;
	font-size: 17px !important;
}
.bb {
	width: 620rpx;
	height: 90rpx;
	background: #8c1608;
	border-radius: 45rpx;
	font-weight: 400;
	font-size: 30rpx;
	color: #ffffff;
	line-height: 0;
}
.wei {
	width: 106rpx;
	height: 106rpx;
	background: #ffffff;
	border-radius: 5rpx;
	font-weight: 400;
	font-size: 30rpx;
	color: #11130b;
}
.xvan {
	background: #8c1608 !important;
	color: #ffffff !important;
}
.sl1 {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	overflow: hidden;
	-webkit-line-clamp: 1;
}
.sl2 {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	overflow: hidden;
	-webkit-line-clamp: 2;
}
.beijing {
	overflow: hidden;
	padding: 0 25rpx;
}
.beijing1 {
	min-height: 100vh;
	background-color: #f0e8dc;
	//系统tabbar不要加注释掉
	padding-bottom: env(safe-area-inset-bottom);
	box-sizing: border-box;
}
</style>
